﻿<!doctype html>
<html>
<head>
    <title></title>
    <!--<script type="text/javascript" src="../Scripts/config.js"></script>-->
    <script type="text/javascript" src="./jquery/jquery.min.js"></script>
    <script src="javascript/QueryString.js" type="text/javascript"></script>
</head>
<body>
    <fieldset>
        <legend>&nbsp;电子签名设置&nbsp;</legend>
        <p align="center">
            <img id="sigimg"  width="120" height="30"   border="1" onerror="this.src='../../DataUser/Siganture/UnName.jpg'" />
        </p>
        上传<input type="file" name="myfile" id="myfile" />
            <input id="btn" type="button" value="确定" onclick="Upload()" /></br></br>

        <b>利用扫描仪设置步骤:</b>
        <ul>
            <li>在白纸上写下您的签名</li>
            <li>送入扫描仪扫描，并得到jpg文件。</li>
            <li>利用图片处理工具把他们处理缩小到 90*30像素大小。</li>
        </ul>
        <b>手写设置:</b>
        <ul>
            <li>启动画板程序，写下您的签名。</li>
            <li>保存成.jpg文件，设置文件为90*30像素大小。</li>
        </ul>
        <!--<B>让系统自动为您创建（请选择字体）:</B><ul><li><a href='Siganture.htm?RefNo=Siganture&DoType=ST'>宋体</a></li> -->
        <!--<li><a href='Siganture.htm?RefNo=Siganture&DoType=LS'>隶书</a></li> 	-->
    </fieldset>

     <script type="text/javascript" language="javascript">

         //页面启动函数.
         $(function () {

             var empNo = GetQueryString("EmpNo");

             //初始化
             $.ajax({
                 // url: Handler + "?DoType=Siganture_Init",
                 url: "Handler.ashx?DoType=Siganture_Init&EmpNo=" + empNo,
                 dataType: "json",
                 success: function (data) {
                     var img = document.getElementById("sigimg");
                  //   alert(data);

                     var url = '/DataUser/Siganture/' + data[0].No + '.jpg';
                     img.src = url;
                 }
             });

         });

         function Upload() {

             //  var url = Handler + "?DoType=Siganture_Save";
             var empNo = GetQueryString("EmpNo");
             var url = "Handler.ashx?DoType=Siganture_Save&EmpNo="+empNo;

             var xhr = new XMLHttpRequest();
             xhr.open('post', url, true);
             var formData = new FormData();
             formData.append('file', myfile.files[0]);
             xhr.send(formData);

             //上传结束回掉函数
             xhr.onload = function () {

                 if (this.responseText.indexOf('err@') == 0) {
                     alert(responseText);
                     return;
                 }
                 alert(this.responseText);
                 window.location.href = window.location.href;
                 //location.reload();
             }
         }
	</script>
</body>
</html>
